import React, { Component } from "react";
import { Link } from 'react-router-dom';
import { Breadcrumb } from "antd";

export default class Bread extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  itemRender = (route, params, routes, paths) => {
    const last = routes.indexOf(route) === routes.length - 1;
    return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
  }

  render() {
    return (
      <div>
        <Breadcrumb itemRender={this.itemRender} routes={this.props.routes} />
      </div>
    );
  }
}
